<template>
    <div>
        {{obj.title}}
    </div>
</template>
<script>
export default {
    data(){
        return {
            obj:JSON.parse(localStorage.getItem('detail')) || {}
        }
    },
    created(){
        this.$http.get(`/api/detail?id=${this.$route.params.id}`).then(res => {
            if(res.data.code === 1){
                this.obj = res.data.data;
                localStorage.setItem('detail',JSON.stringify(this.obj));
            }
        })
    }
}
</script>
